home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / perlpod.z / perlpod
Text File  |  1998-10-30  |  12KB  |  331 lines

  1.  
  2.  
  3.  
  4. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      perlpod - plain old documentation
  10.  
  11. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  12.      A pod-to-whatever translator reads a pod file paragraph by paragraph, and
  13.      translates it to the appropriate output format.  There are three kinds of
  14.      paragraphs:
  15.  
  16.      +o   A verbatim paragraph, distinguished by being indented (that is, it
  17.          starts with space or tab).  It should be reproduced exactly, with
  18.          tabs assumed to be on 8-column boundaries.  There are no special
  19.          formatting escapes, so you can't italicize or anything like that.  A
  20.          \ means \, and nothing else.
  21.  
  22.      +o   A command.  All command paragraphs start with "=", followed by an
  23.          identifier, followed by arbitrary text that the command can use
  24.          however it pleases.  Currently recognized commands are
  25.  
  26.              =head1 heading
  27.              =head2 heading
  28.              =item text
  29.              =over N
  30.              =back
  31.              =cut
  32.              =pod
  33.              =for X
  34.              =begin X
  35.              =end X
  36.  
  37.          The "=pod" directive does nothing beyond telling the compiler to lay
  38.          off parsing code through the next "=cut".  It's useful for adding
  39.          another paragraph to the doc if you're mixing up code and pod a lot.
  40.  
  41.          Head1 and head2 produce first and second level headings, with the
  42.          text in the same paragraph as the "=headn" directive forming the
  43.          heading description.
  44.  
  45.          Item, over, and back require a little more explanation: "=over"
  46.          starts a section specifically for the generation of a list using
  47.          "=item" commands. At the end of your list, use "=back" to end it. You
  48.          will probably want to give "4" as the number to "=over", as some
  49.          formatters will use this for indentation.  This should probably be a
  50.          default. Note also that there are some basic rules to using =item:
  51.          don't use them outside of an =over/=back block, use at least one
  52.          inside an =over/=back block, you don't _have_ to include the =back if
  53.          the list just runs off the document, and perhaps most importantly,
  54.          keep the items consistent: either use "=item *" for all of them, to
  55.          produce bullets, or use "=item 1.", "=item 2.", etc., to produce
  56.          numbered lists, or use "=item foo", "=item bar", etc., i.e., things
  57.          that looks nothing like bullets or numbers. If you start with bullets
  58.          or numbers, stick with them, as many formatters use the first "=item"
  59.          type to decide how to format the list.
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  71.  
  72.  
  73.  
  74.          For, begin, and end let you include sections that are not interpreted
  75.          as pod text, but passed directly to particular formatters. A
  76.          formatter that can utilize that format will use the section,
  77.          otherwise it will be completely ignored.  The directive "=for"
  78.          specifies that the entire next paragraph is in the format indicated
  79.          by the first word after "=for", like this:
  80.  
  81.           =for html <br>
  82.            <p> This is a raw HTML paragraph </p>
  83.  
  84.          The paired commands "=begin" and "=end" work very similarly to
  85.          "=for", but instead of only accepting a single paragraph, all text
  86.          from "=begin" to a paragraph with a matching "=end" are treated as a
  87.          particular format.
  88.  
  89.          Here are some examples of how to use these:
  90.  
  91.           =begin html
  92.  
  93.           <br>Figure 1.<IMG SRC="figure1.png"><br>
  94.  
  95.           =end html
  96.  
  97.           =begin text
  98.  
  99.             ---------------
  100.             |  foo        |
  101.             |        bar  |
  102.             ---------------
  103.  
  104.           ^^^^ Figure 1. ^^^^
  105.  
  106.           =end text
  107.  
  108.          Some format names that formatters currently are known to accept
  109.          include "roff", "man", "latex", "tex", "text", and "html". (Some
  110.          formatters will treat some of these as synonyms.)
  111.  
  112.          And don't forget, when using any command, that the command lasts up
  113.          until the end of the ppppaaaarrrraaaaggggrrrraaaapppphhhh, not the line. Hence in the examples
  114.          below, you can see the empty lines after each command to end its
  115.          paragraph.
  116.  
  117.          Some examples of lists include:
  118.  
  119.           =over 4
  120.  
  121.           =item *
  122.  
  123.           First item
  124.  
  125.           =item *
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  137.  
  138.  
  139.  
  140.           Second item
  141.  
  142.           =back
  143.  
  144.           =over 4
  145.  
  146.           =item Foo()
  147.  
  148.           Description of Foo function
  149.  
  150.           =item Bar()
  151.  
  152.           Description of Bar function
  153.  
  154.           =back
  155.  
  156.  
  157.      +o   An ordinary block of text.  It will be filled, and maybe even
  158.          justified.  Certain interior sequences are recognized both here and
  159.          in commands:
  160.  
  161.              I<text>     italicize text, used for emphasis or variables
  162.              B<text>     embolden text, used for switches and programs
  163.              S<text>     text contains non-breaking spaces
  164.              C<code>     literal code
  165.              L<name>     A link (cross reference) to name
  166.                              L<name>             manual page
  167.                              L<name/ident>       item in manual page
  168.                              L<name/"sec">       section in other manual page
  169.                              L<"sec">            section in this manual page
  170.                                                  (the quotes are optional)
  171.                              L</"sec">           ditto
  172.              F<file>     Used for filenames
  173.              X<index>    An index entry
  174.              Z<>         A zero-width character
  175.              E<escape>   A named character (very similar to HTML escapes)
  176.                              E<lt>               A literal <
  177.                              E<gt>               A literal >
  178.                              (these are optional except in other interior
  179.                               sequences and when preceded by a capital letter)
  180.                              E<n>                Character number n (probably in ASCII)
  181.                              E<html>             Some non-numeric HTML entity, such
  182.                                                  as E<Agrave>
  183.  
  184.  
  185.      That's it.  The intent is simplicity, not power.  I wanted paragraphs to
  186.      look like paragraphs (block format), so that they stand out visually, and
  187.      so that I could run them through fmt easily to reformat them (that's F7
  188.      in my version of vvvviiii).  I wanted the translator (and not me) to worry
  189.      about whether " or ' is a left quote or a right quote within filled text,
  190.      and I wanted it to leave the quotes alone, dammit, in verbatim mode, so I
  191.      could slurp in a working program, shift it over 4 spaces, and have it
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  203.  
  204.  
  205.  
  206.      print out, er, verbatim.  And presumably in a constant width font.
  207.  
  208.      In particular, you can leave things like this verbatim in your text:
  209.  
  210.          Perl
  211.          FILEHANDLE
  212.          $variable
  213.          function()
  214.          manpage(3r)
  215.  
  216.      Doubtless a few other commands or sequences will need to be added along
  217.      the way, but I've gotten along surprisingly well with just these.
  218.  
  219.      Note that I'm not at all claiming this to be sufficient for producing a
  220.      book.  I'm just trying to make an idiot-proof common source for nroff,
  221.      TeX, and other markup languages, as used for online documentation.
  222.      Translators exist for ppppoooodddd2222mmmmaaaannnn  (that's for _n_r_o_f_f(1) and _t_r_o_f_f(1)),
  223.      ppppoooodddd2222hhhhttttmmmmllll, ppppoooodddd2222llllaaaatttteeeexxxx, and ppppoooodddd2222ffffmmmm.
  224.  
  225. EEEEmmmmbbbbeeeeddddddddiiiinnnngggg PPPPooooddddssss iiiinnnn PPPPeeeerrrrllll MMMMoooodddduuuulllleeeessss
  226.      You can embed pod documentation in your Perl scripts.  Start your
  227.      documentation with a "=head1" command at the beginning, and end it with a
  228.      "=cut" command.  Perl will ignore the pod text.  See any of the supplied
  229.      library modules for examples.  If you're going to put your pods at the
  230.      end of the file, and you're using an __END__ or __DATA__ cut mark, make
  231.      sure to put an empty line there before the first pod directive.
  232.  
  233.          __END__
  234.  
  235.          =head1 NAME
  236.  
  237.          modern - I am a modern module
  238.  
  239.      If you had not had that empty line there, then the translators wouldn't
  240.      have seen it.
  241.  
  242. CCCCoooommmmmmmmoooonnnn PPPPoooodddd PPPPiiiittttffffaaaallllllllssss
  243.      +o   Pod translators usually will require paragraphs to be separated by
  244.          completely empty lines.  If you have an apparently empty line with
  245.          some spaces on it, this can cause odd formatting.
  246.  
  247.      +o   Translators will mostly add wording around a L<> link, so that
  248.          L<_f_o_o(1)> becomes "the _f_o_o(1) manpage", for example (see ppppoooodddd2222mmmmaaaannnn for
  249.          details).  Thus, you shouldn't write things like the L<foo> manpage,
  250.          if you want the translated document to read sensibly.
  251.  
  252.      +o   The script _p_o_d/_c_h_e_c_k_p_o_d_s._P_L in the Perl source distribution provides
  253.          skeletal checking for lines that look empty but aren't oooonnnnllllyyyy, but is
  254.          there as a placeholder until someone writes Pod::Checker.  The best
  255.          way to check your pod is to pass it through one or more translators
  256.          and proofread the result, or print out the result and proofread that.
  257.          Some of the problems found may be bugs in the translators, which you
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))                                                          PPPPEEEERRRRLLLLPPPPOOOODDDD((((1111))))
  269.  
  270.  
  271.  
  272.          may or may not wish to work around.
  273.  
  274. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  275.      the _p_o_d_2_m_a_n manpage and the section on _P_O_D_s: _E_m_b_e_d_d_e_d _D_o_c_u_m_e_n_t_a_t_i_o_n in
  276.      the _p_e_r_l_s_y_n manpage
  277.  
  278. AAAAUUUUTTTTHHHHOOOORRRR
  279.      Larry Wall
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.